<?php
require_once('adscaptchalib.php');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
	<title>AdsCaptcha for PHP</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
	<form action="" method="post">
		<?php
		$captchaId  = '1279';   // Set your captcha id here
		$publicKey  = 'ef656b8b-200e-43c8-bec4-d2088db8f546 ';   // Set your public key here
		$privateKey = 'eae9918c-392a-4540-bd8f-9fe962cbab3b ';   // Set your private key here
		$challengeValue = $_POST['adscaptcha_challenge_field'];
		$responseValue  = $_POST['adscaptcha_response_field'];
		$remoteAddress  = $_SERVER["REMOTE_ADDR"];
		
		if ($challengeValue == null) {
			echo GetCaptcha($captchaId, $publicKey);
			?>
			<input type="submit" id="submit" name="submit" />
			<?php
		} else {
			if (ValidateCaptcha($captchaId, $privateKey, $challengeValue, $responseValue, $remoteAddress) == "true")
			{
				echo "Correct :)";
				// Corrent answer, continue with your submission process
			} else {
				echo "Wrong :(";
				// Wrong answer, you may display a new AdsCaptcha and add an error message 
			}
		}		
		?>
	</form>
</body>
</html>